import Vue from 'vue'
import Router from 'vue-router'
import Login from './views/login'
import Admin from './views/admin'
import Welcome from './views/admin/welcome'
import ModuleCategory from './views/admin/module-category';
import ModuleSection from './views/admin/module-section';
import BackModule from './views/admin/back-module';
import SystemSingleInfoSet from './views/admin/system-single-info-set';
import ModuleInfo from './views/admin/module-info';
import File from "./views/admin/file";
import SystemAdmin from './views/admin/system-admin';
import SystemMessage from './views/admin/system-message';
import SystemSingleInfo from './views/admin/system-single-info';
import SystemLinks from './views/admin/system-links';
import SystemSite from  './views/admin/system-site';
import SystemThirdCode from './views/admin/system-third-code';
import ArticleContent from './views/admin/article-content';
import ProductContent from './views/admin/product-content';

Vue.use(Router);
//修改是，严谨格式化，对已有的代码，不要格式化
export default new Router({
    // history指定的跳转路径只返回login，hash指定的返回加入了#/
    mode:'history',
    base:process.env.BASE_URL,
    //path指定跳转地址：输入任何值'*'都会跳转到login
    routes:[/*{
        path:'*',
        redirect:"/login",
    },{
        path:'',
        redirect:"/login",
    },*/{
        //component:指明/login跳转加载的组件
        path: "/login",
        component: Login
    },{
        //配置admin路由
        path: "/",
        name: "admin",
        component: Admin,
        meta:{
            //自定义登录拦截属性，只要父路由admin做登陆拦截，其他子路由都会生效
            // 做main.js-router.beforeEach(guard:()=>{})守卫函数
            //loginRequire:true
        },
        children:[{
            path: "welcome",
            name: "welcome",
            component: Welcome
        },{
            //栏目管理-栏目分类
            path: "business/module-category",
            name: "business/module-category",
            component: ModuleCategory
        },{
            //配置栏目小节路由section
            path: "business/module-section",
            name: "business/module-section",
            component: ModuleSection
        },{
            //配置back（备用）路由course
            path: "business/back-module",
            name: "business/back-module",
            component: BackModule
        },{
            //配置栏目信息管理路由
            path: "business/module-info",
            name: "business/module-info",
            component: ModuleInfo
        },{
            //配置文章发布路由
            path: "business/article-content",
            name: "business/article-content",
            component: ArticleContent
        },{
            //配置产品发布路由
            path: "business/product-content",
            name: "business/product-content",
            component: ProductContent
        },{
            //配置文件管理路由file
            path: "file/file",
            name: "file/file",
            component: File
        },{
            //配置用户管理路由user
            path: "manager/system-admin",
            name: "manager/system-admin",
            component: SystemAdmin
        },{
            //配置资源管理路由resources
            path: "manager/system-message",
            name: "manager/system-message",
            component: SystemMessage
        },{
            //配置独立信息管理路由roles
            path: "manager/system-single-info",
            name: "manager/system-single-info",
            component: SystemSingleInfo
        },{
            //配置友情链接路由roles
            path: "manager/system-links",
            name: "manager/system-links",
            component: SystemLinks
        },{
            //配置站点设置路由roles
            path: "manager/system-site",
            name: "manager/system-site",
            component: SystemSite
        },{
            //配置第三方代码路由roles
            path: "manager/system-third-code",
            name: "manager/system-third-code",
            component: SystemThirdCode
        }]
    }]
})